// ========================== 
// 描述：报错中心
// 作者：MING
// 创建时间：2021/11/10 15:48:58 
// 版本：1.0
// ========================== 
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum ErrorType
{
    /// <summary>
    /// 未知错误
    /// </summary>
    None = 0,
    /// <summary>
    /// 出票错误
    /// </summary>
    Ticket,


}

public class ErrorSystem : MonoBehaviour
{   
    private GameObject ErrorPanel;
    public Dictionary<ErrorType, Transform> dicError = new Dictionary<ErrorType, Transform>();

    public void MakeSure()
    {
        if (ErrorPanel == null)
            ErrorPanel = GameObject.Find("Canvas Debug/ErrorPanel");
        if (dicError.Count == 0)
        {
            for (int i = 0; i < (int)ErrorType.Ticket; i++)
            {
                dicError.Add((ErrorType)i, ErrorPanel.transform.Find(((ErrorType)i).ToString()));
            }
        }
    }
    public void DebugError(ErrorType error)
    {
        MakeSure();
        dicError[error].gameObject.SetActive(true);
    }

    public void EndError(ErrorType error)
    {
        MakeSure();
        dicError[error].gameObject.SetActive(false);
    }

}
